With the rapid development of mobile Internet, demands for viewing videos on mobile terminal keep increasing. Using Android operating system illustrates a rendering process. When browser loads or updates a webpage that contains a video, it sequentially renders the video and other contents first and then integrates them together for display on screen. It is easier to render a video-free webpage because it needs to render the data by browser to a window and output it to the screen for display. For video webpage, however, it needs to use a video component to render the content to a pre-allocated rendering interface. To play the video, the rendered video will be retrieved from the rendering interface to the screen.
In current technologies, the system kernel will send a loading message to the system shell upon parsing or inserting, via JavaScript, a video node into a webpage when video is being rendered on the webpage. The system shell then creates a video component for each video node according to the loading message, e.g. SurfaceView, SurfaceTexture, etc. When user clicks to play a video that has an associated video node, the video component associated with this video node will render the video to a rendering interface and transmit them to the screen for play. When user clicks to play another video that has an associated video node, the rendering process of the current video will be suspended and the rendering process of the new video node will start. Upon refreshing or closing of a video webpage, the kernel will release all video nodes on that video webpage and send a stop message to the system shell to notify the shell to release the video component associates with the video nodes.
During implementation of rendering, in current technology, the system creates a set of corresponding video components for each video node regardless of whether or not the user clicks such a video node on the webpage. When a webpage contains many videos, a plurality of video components will be occupied. Since different video components need to use different loading interfaces and locking, waiting, inter-process communication and other operations are executed for rendering different loading interfaces, the webpage loading process becomes complicated and time-consuming which may cause the webpage to break down. Moreover, creating multiple video components consumes considerable system resources and increases the probability of lack of memory, thereby worsening user experience.